package com.example.ry.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import com.example.ry.dao.BaseDao;

@Repository(value="baseDao")
public class BaseDaoImpl<T,ID> implements BaseDao<T,ID>{

	@Resource(name="sqlSessionTemplate")
	private SqlSessionTemplate session;
	
	public Integer save(String sql, T t) {
		return session.insert(sql, t);
	}
	
	public Integer update(String sql, T t) {
		return session.update(sql,t);
	}
	
	public Integer delete(String sql, T t) {
		return session.delete(sql, t);
	}
	
	public List<T> findAll(String sql, ID id) {
		return session.selectList(sql, id);
	}
	
	public T findOne(String sql, ID id) {
		return session.selectOne(sql, id);
	}
	
	
}
